package com.windward.vii.dao.mapper;

import com.windward.vii.dao.entity.Report;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface ReportMapper {
    @Delete({
        "delete from report",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into report (id, reporter_uid, ",
        "target_uid, create_time)",
        "values (#{id,jdbcType=BIGINT}, #{reporterUid,jdbcType=BIGINT}, ",
        "#{targetUid,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP})"
    })
    int insert(Report record);

    int insertSelective(Report record);

    @Select({
        "select",
        "id, reporter_uid, target_uid, create_time",
        "from report",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    Report selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Report record);

    @Update({
        "update report",
        "set reporter_uid = #{reporterUid,jdbcType=BIGINT},",
          "target_uid = #{targetUid,jdbcType=BIGINT},",
          "create_time = #{createTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Report record);
}